namespace WebAPI.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Area",
                c => new
                    {
                        AreaId = c.Int(nullable: false, identity: true),
                        ParentId = c.Int(nullable: false),
                        AreaName = c.String(),
                        AreaCode = c.String(),
                    })
                .PrimaryKey(t => t.AreaId);
            
            CreateTable(
                "dbo.Collect",
                c => new
                    {
                        CollectId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        GoodsID = c.Int(nullable: false),
                        CollectTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.CollectId);
            
            CreateTable(
                "dbo.Comment",
                c => new
                    {
                        CommentID = c.Int(nullable: false, identity: true),
                        GoodsID = c.Int(nullable: false),
                        CommentUserName = c.String(),
                        CommentTime = c.DateTime(nullable: false),
                        CommentStarLevel = c.Int(nullable: false),
                        CommentContent = c.String(),
                        DisplayTime = c.String(),
                    })
                .PrimaryKey(t => t.CommentID);
            
            CreateTable(
                "dbo.ConsigneeAddress",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        IsDefault = c.Int(nullable: false),
                        IsDelete = c.Int(nullable: false),
                        ConsigneeName = c.String(),
                        ConsigneeTel = c.String(),
                        ConsigneeArea = c.String(),
                        AddressDetail = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.FeedbackMsg",
                c => new
                    {
                        FeedbackId = c.Int(nullable: false, identity: true),
                        FeedbackContent = c.String(),
                        UserId = c.Int(nullable: false),
                        FeedbackTime = c.DateTime(nullable: false),
                        ContactWay = c.String(),
                        FeedbackType = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.FeedbackId);
            
            CreateTable(
                "dbo.FeedbackType",
                c => new
                    {
                        FeedbackTypeId = c.Int(nullable: false, identity: true),
                        FeedbackName = c.String(),
                    })
                .PrimaryKey(t => t.FeedbackTypeId);
            
            CreateTable(
                "dbo.Goods",
                c => new
                    {
                        GoodsId = c.Int(nullable: false, identity: true),
                        GoodsName = c.String(),
                        GoodsTypeId = c.Int(nullable: false),
                        GoodsPrice = c.Single(nullable: false),
                        GoodsPostTime = c.DateTime(nullable: false),
                        GoodsStoreNum = c.Int(nullable: false),
                        GoodsMarketPrice = c.Single(nullable: false),
                        GoodsIntegral = c.Int(nullable: false),
                        GoodsContent = c.String(),
                        GoodsRule = c.String(),
                        GoodsDisplayImgUrl = c.String(),
                    })
                .PrimaryKey(t => t.GoodsId);
            
            CreateTable(
                "dbo.GoodsImages",
                c => new
                    {
                        ImagesId = c.Int(nullable: false, identity: true),
                        GoodsId = c.Int(nullable: false),
                        ImageUrl = c.String(),
                    })
                .PrimaryKey(t => t.ImagesId);
            
            CreateTable(
                "dbo.GoodsType",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TypeName = c.String(),
                        TypeImg = c.String(),
                        fatherTypeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.NewsInfo",
                c => new
                    {
                        NewsId = c.Int(nullable: false, identity: true),
                        NewsName = c.String(),
                        NewsContent = c.String(),
                        NewsImg = c.String(),
                        NewsPostTime = c.DateTime(nullable: false),
                        NewsType = c.Int(nullable: false),
                        NewsTypeName = c.String(),
                        DisplayTime = c.String(),
                    })
                .PrimaryKey(t => t.NewsId);
            
            CreateTable(
                "dbo.UserInfo",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                        UserSex = c.String(),
                        UserPwd = c.String(),
                        UserTel = c.String(),
                        UserType = c.Int(nullable: false),
                        UserImg = c.String(),
                        UserTypeName = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.UserInfo");
            DropTable("dbo.NewsInfo");
            DropTable("dbo.GoodsType");
            DropTable("dbo.GoodsImages");
            DropTable("dbo.Goods");
            DropTable("dbo.FeedbackType");
            DropTable("dbo.FeedbackMsg");
            DropTable("dbo.ConsigneeAddress");
            DropTable("dbo.Comment");
            DropTable("dbo.Collect");
            DropTable("dbo.Area");
        }
    }
}
